#include<iostream>
#include<algorithm>

using namespace std;

void solve(int n){

    if(n % 2 == 0){
        for (int i = 1; i + 1 <= n; i += 2){
            cout << i + 1 << " " << i << " ";
        }
    }else if(n % 2 == 1){
        cout << 1 << " ";
        for (int i = 2; i + 1 <= n; i += 2){
            cout << i + 1 << " " << i << " ";
        }
    }

    cout << endl;
}

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    int T;

    cin >> T;
    while(T--){
        int n;
        cin >> n;
        solve(n);
    }

    return 0;
}